package com.px.tc_ip;

import java.io.*;
import java.net.ServerSocket;
import java.net.Socket;

public class ServerDemo {
    public static void main(String[] args) {
        try {
            ServerSocket  serverSocket = new ServerSocket(583);
            System.out.print("服务端启动");
            Socket socket=serverSocket.accept();
            System.out.println("客户端端口"+socket.getPort());
            //BufferedInputStream bu=new BufferedInputStream(new DataInputStream(socket.getInputStream()));
            InputStreamReader bu=new InputStreamReader(socket.getInputStream(),"UTF-8");
            //DataInputStream bu=new DataInputStream(socket.getInputStream());
           /* BufferedReader bu=new BufferedReader(new InputStreamReader(socket.getInputStream()));
            String ss=bu.readLine();
            System.out.println(ss);*/
            //System.out.println(bu.readLine());

            int ss;
           while ((ss=bu.read())>-1){
              System.out.print((char) ss);
           }
        } catch (IOException e) {
            e.printStackTrace();
        }


    }
    }

